<span page-title ng-model="host">{{ 'Packages for: ' | translate }} {{ host.name }}</span>

<h3 translate>Applicable Packages</h3>
<div ng-show="katelloAgentPresent" data-extend-template="common/views/katello-agent-notice.html"></div>

<section ng-hide="denied('edit_hosts', host)" bst-feature-flag="remote_actions">
  <p bst-alert="warning" ng-hide="hostToolingEnabled">
    <span translate>
      Performing host package actions is disabled because Katello is not configured for Remote Execution or Katello Agent.
      </span>
  </p>
</section>

<div data-extend-template="layouts/partials/table.html">

  <span data-block="no-rows-message" translate>
    The host has not reported any applicable packages for upgrade.
  </span>

  <span data-block="no-search-results-message" translate>
    Your search returned zero Packages.
  </span>

  <div data-block="list-actions" bst-feature-flag="remote_actions">
    <div ng-hide="denied('edit_hosts', host)" class="nutupane-actions fr">
      <form ng-submit="performDefaultUpdateAction()" role="form">

        <span uib-dropdown class="btn-group">
          <button class="btn btn-primary" type="button"
                  ng-click="performDefaultUpdateAction()"
                  ng-hide="denied('edit_hosts', host)"
                  ng-disabled="working || table.numSelected === 0 || !hostToolingEnabled"
                  translate>
            Upgrade Selected
          </button>
          <button uib-dropdown-toggle class="btn btn-default"
                  ng-hide="!remoteExecutionPresent || denied('edit_hosts', host)"
                  ng-disabled="working ||  table.numSelected === 0"
                  type="button" id="use-remote-execution">
            <span class="caret"></span>
          </button>
          <ul uib-dropdown-menu role="menu" aria-labelledby="use-remote-execution">
            <li ng-show="katelloAgentPresent" role="presentation"><a ng-click="performViaKatelloAgent('packageUpdate', getKatelloAgentCommand())" role="menuitem" tabindex="-1" href="#" translate>via Katello agent</a></li>
            <li role="presentation"><a ng-click="performViaRemoteExecution('packageUpdate', getRemoteExecutionCommand(), false)" role="menuitem" tabindex="-1" href="#" translate>via remote execution</a></li>
            <li role="presentation"><a ng-click="performViaRemoteExecution('packageUpdate', getRemoteExecutionCommand(), true)" role="menuitem" tabindex="-1" href="#" translate>via remote execution - customize first</a></li>
          </ul>
        </span>

        <button class="btn btn-default"
                type="button"
                translate
                ng-disabled="working || !katelloAgentPresent"
                ng-click="updateAll()">
          Update All Packages
        </button>
      </form>
    </div>
  </div>

  <div data-block="table">
    <table bst-table="table" ng-class="{'table-mask': table.working}" class="table table-full table-striped">
      <thead>
      <tr bst-table-head row-select>
        <th bst-table-column="name" translate>Upgradable Package</th>
      </tr>
      </thead>

      <tbody>
        <tr bst-table-row ng-repeat="package in table.rows" row-select="package">
          <td bst-table-cell>{{ package.nvrea }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

